package com.synergy.stockflow.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 用户-角色关联表
 */
@Schema(description = "用户-角色关联表")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_user_role")
public class SysUserRole {
    /**
     * 关联编号
     */
    @TableId(value = "id", type = IdType.INPUT)
    @Schema(description = "关联编号")
    private Long id;

    /**
     * 关联sys_user
     */
    @TableField(value = "sys_user_id")
    @Schema(description = "关联sys_user")
    private Long sysUserId;

    /**
     * 关联sys_role
     */
    @TableField(value = "sys_role_id")
    @Schema(description = "关联sys_role")
    private Integer sysRoleId;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField(exist = false)
    @Schema(description = "角色")
    private SysRole sysRole;
}